home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_359 / dice / dice.lzh / lib / stdlib / system.c < prev   
C/C++ Source or Header  |  1990-03-30  |  753b  |  45 lines

  1.  
  2. /*
  3.  *  SYSTEM.C        Dynamically check whether we are running under 1.3 or 1.4
  4.  *
  5.  *  (c)Copyright 1990, Matthew Dillon, All Rights Reserved
  6.  */
  7.  
  8. #include <exec/types.h>
  9. #include <exec/libraries.h>
  10.  
  11. #ifdef INCLUDE_VERSION        /*    doesn't exist in 1.3 */
  12. #include <dos/dostags.h>
  13. #endif
  14.  
  15. extern struct Library *DOSBase;
  16.  
  17. system(buf)
  18. const char *buf;
  19. {
  20.     int r;
  21.  
  22. #ifdef INCLUDE_VERSION
  23.     if (DOSBase->lib_Version >= 36) {
  24.     static struct TagItem TI[] = {
  25.         SYS_Input , 0,
  26.         SYS_Output, 0,
  27.         TAG_DONE, 0
  28.     };
  29.     TI[0].ti_Data = Input();
  30.     TI[1].ti_Data = Output();
  31.     r = System(buf, TI);
  32.     } else {
  33. #endif
  34.     r = Execute(buf, NULL, NULL);
  35.     if (r == 0)
  36.         r = -1;
  37.     else if (r == -1)
  38.         r = 0;
  39. #ifdef INCLUDE_VERSION
  40.     }
  41. #endif
  42.     return(r);
  43. }
  44.  
  45.